/*******************************************************************************
 ** Name: Agency.cpp                                                          **
 ** Description:                                                              **
 **                                                                           **
 ** Open Source Initiative (OSI) Approved 2-clause BSD License                **                                                                           **
 **                                                                           **
 **  Copyright (c) 2009-2010 Barry "Gian" James  <bjames@munixos.net>         **
 **  All rights reserved.                                                     **
 **                                                                           **
 **  Redistribution and use in source and binary forms, with or without       **
 **  modification, are permitted provided that the following conditions are   **
 **  met:                                                                     **
 **                                                                           **
 **  * Redistributions of source code must retain the above copyright notice, **
 **    this list of conditions and the following disclaimer.                  **
 **  * Redistributions in binary form must reproduce the above copyright      **
 **    notice, this list of conditions and the following disclaimer in the    **
 **    documentation and/or other materials provided with the distribution.   **
 **                                                                           **
 **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS      **
 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED **
 ** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A           **
 ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT        **
 ** HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,    **
 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED  **
 ** TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR    **
 ** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    **
 ** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING      **
 ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS        **
 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.              **
 **                                                                           **
 ******************************************************************************/
// Created on March 17, 2010, 8:18 PM
// Modified $Date: 2011-10-22 02:09:07 +0000 (Sat, 22 Oct 2011) $ by $Author: gian.james $
#define  Agency_cpp_ID    "$Id: agency.cpp 146 2011-10-22 02:09:07Z gian.james $"

#include "common.hpp"
#include "agency.hpp"
#include "character.hpp"

static std::string    stdGovtRanks[] =
{
    CSTR(GS-0),
    CSTR(GS-1), CSTR(GS-2), CSTR(GS-3), CSTR(GS-4), CSTR(GS-5),
    CSTR(GS-6), CSTR(GS-7), CSTR(GS-8), CSTR(GS-9), CSTR(GS-10),
    CSTR(GS-11), CSTR(GS-12), CSTR(GS-13), CSTR(GS-14), CSTR(GS-15),
    CSTR(GS-16), CSTR(SES-1), CSTR(SES-2), CSTR(SES-3), CSTR(SES-4),
    CSTR(SES-5)

};

static std::string stdMilRanks[] =
{
    CSTR(E-0),
    CSTR(E-1), CSTR(E-2), CSTR(E-3), CSTR(E-4), CSTR(E-5),
    CSTR(E-6), CSTR(E-7), CSTR(E-8), CSTR(E-9), CSTR(WO-1),
    CSTR(O-1), CSTR(O-2), CSTR(O-3), CSTR(O-4), CSTR(O-5),


    CSTR(O-6), CSTR(O-7), CSTR(O-8), CSTR(O-9), CSTR(O-10)
};

static std::string stdMarineRanks[] =
{
    CSTR(Recruit),
    CSTR(Private), CSTR(PFC), "Lance Corporal", "Corporal", "Sergeant",
    "Staff Sergeant", "Gunnery Sergeant", "Master Sergeant", "Sergeant Major",
    CSTR(Warrant),
    CSTR(2ndLT), CSTR(1stLT), "Captain", "Major", "Lt. Colonel",
    CSTR(Colonel), "Brigadier General", "Major General", "Lt. General",
    CSTR(General),
    CSTR(Commandant)
};

static std::string stdFrenchArmy[] =
{
    "Poilu",
    "Soldat de deuxième classe", "Soldat de première classe", "Caporal",
    "Caporal-chef", "Caporal-chef de première classe", "Élève sous-officier",
    "Sergent", "Sergent-chef", "Adjudant", "Major",
    "Sous-lieutenant", "	Lieutenant","Capitaine", "Commandant",
    "Lieutenant-colonel", "Colonel", "General de brigade",
    "General de division", "General de corps d'armee", "General d'armee"
};


/////////////////////////////////[ Agency
Agency::Agency(std::string n)
{
    name = n;
    vis = agency::visibility::common;
    members[0] = members[1] = members[2] = 0;
    funds = 0;
    homeregion = agency::region::namerica;
    cover = "Green Tomato Plant Nursery";

}

void
Agency::AddNewAgent(Character & c)
{
	// FIXME memory leak. what is the purpose of this?
	AgencyRoster *	newAgent = new AgencyRoster();
	newAgent->name = c.Name();
	newAgent->lvl = c.Level();
	newAgent->profession = c.Prof()->Name();
	newAgent->dept = c.Dept();
}

void
Agency::AgentLogout(std::string n)
{
	boost::intrusive::list<AgencyRoster>::iterator i(roster.begin()),
			iend(roster.end());
	for (; i != iend; ++i) {
		if ((&*i)->name == n)
			(&*i)->bOnline = false;
	}
}

void
Agency::AgentLogin(std::string n)
{
	boost::intrusive::list<AgencyRoster>::iterator i(roster.begin()),
			iend(roster.end());
	for (; i != iend; ++i) {
		if ((&*i)->name == n)
			(&*i)->bOnline = true;
	}
}

std::string
Agency::StdFrenchRank(int r)
{
    return stdFrenchArmy[r];
}

std::string
Agency::StdMarineRanks(int r)
{
	return stdMarineRanks[r];
}

std::string
Agency::StdMilRanks(int r)
{
	return stdMilRanks[r];
}

std::string
Agency::StdGovtRanks(int r)
{
	return stdGovtRanks[r];
}

Agency::Agency(const Agency& orig)
{

}

Agency::~Agency()
{

}

